﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chess
{
    public class Move
    {
       
        public Piece piece;
        public Square squareFrom;
        public Square squareTo;
        public Piece piecePlay;

        public Move(Piece Piece, Square From, Square To, Piece pPlay)
        {
            piece = Piece;
            squareFrom = From;
            squareTo = To;
            piecePlay = pPlay;          
        }

        public Piece Piece
        {
            get { return piece; }
            set { piece = value; }
        }

        public Square From
        {
            get { return squareFrom; }
        }

        public Square To
        {
            get { return squareTo; }
        }

        public Piece isPiece
        {
            get { return piecePlay; }
        }

        public static void Undo(Move move)
        {
            move.Piece.Square = move.From;
            move.From.Piece = move.Piece;
            move.To.Piece = move.isPiece;
            Game.History.LastMove();
        }        
    }
}
